package com.xd.core.company.controller;


import com.xd.common.properties.PassWordKeyProperties;
import com.xd.common.util.AESUtil;
import com.xd.core.company.dto.CompanyAccountDto;
import com.xd.core.company.entity.CompanyAccount;
import com.xd.core.company.service.ICompanyAccountService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.util.Arrays;
import java.util.Base64;

/**
 * <p>
 * 企业电子账户信息 前端控制器
 * </p>
 *
 * @author ZX
 * @since 2025-02-28
 */
@RestController
@RequestMapping("/company/company-account")
public class CompanyAccountController {

    @Autowired
    private ICompanyAccountService iCompanyAccountService;

    @ApiOperation("新增放款回款账户")
    @PostMapping("/insertCompanyAccount")
    public void insertCompanyAccount(@RequestBody CompanyAccount companyAccount) {
        iCompanyAccountService.save(companyAccount);
    }

    @PreAuthorize("hasAnyAuthority('sys:AssetManagement-AddAccount')")
    @ApiOperation("修改预存款账户商户号")
    @PostMapping("/updatePrestoreMemberId")
    public void updatePrestoreMemberId(@RequestBody CompanyAccountDto companyAccount) {
        iCompanyAccountService.updatePrestoreMemberId(companyAccount.getCompanyId(), companyAccount.getPrestoreMemberId());
    }


}
